package com.bd03.cmccmonitor.util

import org.apache.commons.lang3.time.FastDateFormat


object DateUtil {
  //2017 0412 03 03 07 768
  private val format: FastDateFormat = FastDateFormat.getInstance("yyyyMMddHHmmssSSS")
  def getDate(str:String)={
    val day = str.substring(0,8)
    val hour = str.substring(8,10)
    val minutes = str.substring(10,12)
    (day,hour,minutes)
  }

  def consumptionTime(start:String,end:String)={
    val startTime =  format.parse(start.substring(0,17)).getTime
    val endTime =  format.parse(end).getTime
    endTime-startTime
  }
}
